<template>
    <div class="sky-background"
      :style="{width:props.size +'px',height:props.size+'px' }"
     :class="{ 'animation-active': animationActive }"
     >
    <!-- <div class="sky-background"
     
     > -->
     
        <div class="moon" :style="{width: props.size*0.3 +'px',height: props.size*0.3+'px' }">
          <div class="moon-cover"></div>
        </div>
        <!-- <div class="irregular-shape"></div> -->
        <div class="cloud">
            <div class="cloud-part"></div>
            <div class="cloud-part"></div>
            <div class="cloud-part"></div>
            
        </div>
            
      </div>
  </template>
  
  <script setup>
  import { ref, onMounted,defineProps } from 'vue';
  
  let props = defineProps({
    size:{
      type: String,
      default: 260,
      require: false
    }
  })
  const animationActive = ref(false);
  
  onMounted(() => {
    // 延迟激活动画，以确保初始状态显示后再开始动画
    setTimeout(() => {
      animationActive.value = true;
    }, 500);
  });
  </script>
  
  <style scoped>
  .irregular-shape {
	  position: absolute;
	/* top: -83px; */
    width: 65px;
    height: 65px;
    border-radius: 50%;
    box-shadow: 18px 0px 0 0 #ffbb00;
    
  }


  .sky-background {
    width: 260px;
    height: 260px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    background: linear-gradient(to bottom, #181241, #6e6195);
    /* z-index: -2; */
  }

  .weather-container{
    width: max-content;
    height: max-content;
    
  }
  
  .moon {
    position: absolute;
	  /* top: -83px; */
    margin-top: -20px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    box-shadow: 18px 0px 0 0 #ffbb00;
    
  }
  .moon-cover{
    width: 80px;
    height: 80px;
    position:relative;
    border-radius: 50%;
    box-shadow: 18px 0px 0 0 #ffbb00;
     opacity: 1;
     filter: blur(5px);

  }
  
  
  .cloud {
    position: relative;
    left: 50px;
    top: 10px;
    width: 260px;
    height: 80px;
    
  }
  .filer{
    backdrop-filter: blur(2px); 
    -webkit-backdrop-filter: blur(2px); 
  }
  
  .cloud-part {
    position: absolute;
    background-color: #ffffff;
    border-radius: 50px;
    filter: blur(5px);
    
    /* opacity: 0.6; */
    
  }
  
  
  .cloud-part:nth-child(1) {

    width: 100px;
    height: 100px;
    top: 0px;
    left: -5px;
    border-radius: 50%;

  }
  
  .cloud-part:nth-child(2) {
    width: 110px;
    height: 60px;
    top: 40px;
    left: 15px;

  }

  
  .cloud-part:nth-child(3) {
    width: 80px;
    height: 70px;

    top: 30px;
    left: 55px; 

  }
  
  .text {
    position: absolute;
    bottom: 40px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 24px;
    color: white;
    font-weight: bold;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
  }
  
  /* 动画效果 */
  @keyframes cloudMove {
    0% {
      transform: translateX(0);
    }
    50% {
      transform: translateX(20px);
    }
    100% {
      transform: translateX(0);
    }
  }
  
  @keyframes sunPulse {
    0% {
      box-shadow: 0 0 50px #ffffff;
    }
    50% {
      box-shadow: 0 0 100px #ffffff;
    }
    100% {
      box-shadow: 0 0 50px #ffffff;
    }
  }
  
  .animation-active .cloud {
    animation: cloudMove 5s infinite ease-in-out;
  }
  
  /* .animation-active .moon {
    animation: sunPulse 3s infinite ease-in-out;
  } */
  </style>